package com.cheng.jkdemo;

import com.cheng.jkdemo.entity.AppKey;
import com.cheng.jkdemo.utils.GetAppKey;
import org.springframework.util.DigestUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class A {


    public static void main(String[] args) {
         String appKey = "1111";

        GetAppKey getAppKey = new GetAppKey();
        AppKey appKeyMain = getAppKey.getAppKeyMain();
        String userName = appKeyMain.getUserName();
        String passWord = appKeyMain.getPassWord();
//        System.out.println(appKeyMain);
        System.out.println("名称："+userName);

        //获取时间戳
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = df.format(new Date());
        //这里还需要转成 long 类型

        System.out.println(time);

        //拼接参数
        StringBuffer stb = new StringBuffer();
        stb.append(appKey).append(userName).append(time);

        //生成md5
        String sing = DigestUtils.md5DigestAsHex(stb.toString().getBytes());
        System.out.println(sing);


    }

}
